<?php
use yii\widgets\ActiveForm;
?>
<link rel="stylesheet" href="../static/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../static/jBox/Skins/Metro/jbox.css" type="text/css">
<link rel="stylesheet" href="../static/dist/css/AdminLTE.min.css" type="text/css">
<link rel="stylesheet" href="../static/css/admin.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/treeTable/jquery.treetable.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/treeTable/jquery.treetable.theme.default.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/datatables/jquery.dataTables.css" type="text/css">
<style>
.ul_tree_display {
	display: none;
}

.tr_tree_display {
	display: none;
}

.table>tbody>tr>td {
	vertical-align: middle;
	font-size: 0.8em;
}

.layui-layer-content p {
	padding: 15px;
}

.dataTables_length {
	margin-top: 10px;
}
.layui-layer {
	-webkit-overflow-scrolling:touch;
	top:10% !important;
	left:0;
	margin:0;
	padding:0;
	background-color:#fff;
	-webkit-background-clip:content;
	box-shadow:1px 1px 50px rgba(0,0,0,.3)
}
</style>
<div class="tabs-panel">
	<div class="row">
		<div class="col-xs-12">
			<div class="box">
				<div class="box-header">
                    <label>一级分类：</label>
                    <select id="category_id" name="category_id" class="depart-input" style="width: 150px">
                        <option value="">请选择</option>
                        <?php if (is_array($category) && count($category) > 0)foreach($category as $value){?>
                            <option value="<?= $value['id']?>"><?= $value['category_name']?></option>
                        <?php }?>
                    </select>&nbsp;
                    <button type="button" class="btn btn-primary depart-modal" onclick="table_list_reload()" style="width: 100px;">查询</button> &nbsp;
                    <button type="button" class="btn btn-warning depart-modal" id="reset_button" style="width: 100px;">重置</button>
                </div>
				<div class="box-header">
					<button type="button" class="btn btn-success depart-modal category-show-btn add-hot-sale" style="width: 100px;">添加</button>
				</div>
				<div class="box-body">
					<table id="table_list" class="table table-bordered table-hover">
						<thead>
							<tr>
								<th class="">操作</th>
								<th class="">排序</th>
								<th class="">所属一级分类</th>
								<th class="">二级分类</th>
								<th class="">图片</th>
								<th class="">图片内容</th>
								<th class="">平台</th>
								<th class=""><?=TITLE_STATUS?></th>
							</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<div class="modal fade" id="category-child-maintain-modal" style="background: rgba(236, 230, 230, 0.3);" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 70%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">二级分类维护</h4>
            </div>
            <div class="modal-body">
                <form action="/category-child-maintain/change-category-child-maintain" method="post" name="category_child_maintain_form" id="category_child_maintain_form">
                    <div class="box-body platform">
                        <label for="tag_group_id_add"><span class="text-danger">* </span>平台</label>
                        <select name="platform" id="platform" style="width: 25%;"  class="form-control">
                        	<option value="1">pc</option>
                        	<option value="2">wap</option>
                        </select>
                    </div>
                    <div class="box-body child_father">
                        <div class="form-group category_father">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>所属一级分类</label>
                            <select id="category_id_tow" name="category_id" onChange="changeCategory(this)" class="depart-input" style="width: 150px">
                            	<option value="0">-请选择-</option>
                            	<?php if (is_array($category) && count($category) > 0)foreach($category as $value){?>
                                <option value="<?= $value['id']?>"><?= $value['category_name']?></option>
                            	<?php }?>
                            </select>
                        </div>
                    </div>
                    <div class="box-body hide child_project">
                    	<div class="form-group category_child">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>所属二级分类</label>
                            <select id="category_child" name="category_child" class="depart-input" style="width: 150px">
                            	<option value="0">-请选择-</option>
                            </select>
                        </div>
                        <div class="form-group sort">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>排序</label>
                            <input style="width: 50%;" class="form-control" name="sort" placeholder="排序编号" id="sort"/>
                        </div>
                        <div class="form-group picture_class">
                            <button type="button" class="btn btn-success depart-modal upload-img-btn" data-type="1" style="width: 100px;">上传图片</button>
                            <br><br><img src="" class="bgimg">
                            <input type="hidden" value="" name="picture_url_dan" class="form-control">
                        </div>
                        <div class="form-group picture_table">
                            <button type="button" class="btn btn-success depart-modal" id="add_input" style="width: 100px;">添加图片</button>
                            <table class="table table-hover" id="input_table">
                            	<thead>
                                    <tr>
                                        <th width="40%">图片链接</th>
                                        <th width="20%">图片</th>
                                        <th width="20%">查看图片</th>
                                        <th width="20%">操作</th>
                                    </tr>
                                </thead>
                                <tbody class="tbody-class">
                                </tbody>
                            </table>
                        </div>
                        <div class="form-group product_url">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>点击链接</label>
                            <input style="width: 50%;" class="form-control" name="product_url_dan" placeholder="商品链接" id="product_url"/>
                        </div>
                        <div class="form-group ext2">
                            <label for="tag_group_id_add">内容</label>
                            <input style="width: 50%;" class="form-control" name="ext2" placeholder="文字描述" id="ext2"/>
                        </div>
                        <div class="form-group use_flg">
                            <label for="tag_group_id_add"><span class="text-danger">* </span>状态</label>
                            <select name="use_flg" id="use_flg" style="width: 25%;"  class="form-control">
                            	<option value="1">启用</option>
                            	<option value="0">禁用</option>
                            </select>
                        </div>
                    </div>
                    <div class="box-body hide platform_2">
                        <label for="tag_group_id_add">平台</label>
                    </div>
                    <div class="box-body hide select_html">
                        <div class="form-group category_father">
                            <label for="tag_group_id_add">所属一级分类</label>
                        </div>
                    </div>
                    <div class="box-body hide select_html_2">
                    	<div class="form-group category_child">
                            <label for="tag_group_id_add">所属二级分类</label>
                        </div>
                        <div class="form-group sort">
                            <label for="tag_group_id_add">排序</label>
                        </div>
                        <div class="form-group picture_class">
                            <img src="" class="bgimg">
                        </div>
                        <div class="form-group picture_table">
                            <table class="table table-hover">
                            	<thead>
                                    <tr>
                                        <th width="40%">图片链接</th>
                                        <th width="20%">图片</th>
                                        <th width="20%">查看图片</th>
                                        <th width="20%">操作</th>
                                    </tr>
                                </thead>
                                <tbody class="tbody-class">
                                </tbody>
                            </table>
                        </div>
                        <div class="form-group product_url">
                            <label for="tag_group_id_add">点击链接</label>
                        </div>
                        <div class="form-group ext2">
                            <label for="tag_group_id_add">内容</label>
                        </div>
                        <div class="form-group use_flg">
                            <label for="tag_group_id_add">状态</label>
                        </div>
                    </div>
                    <input name="hot_sale_id" type="hidden" id="hot_sale_id">
                </form>
                <div style="display: none">
                    <?php $form = ActiveForm::begin(['id'=>'upload_form_update','action'=>'/common/img-upload'],['options' => ['enctype' => 'multipart/form-data']]) ?>
                    <?= $form->field($model, 'img_url')->fileInput(['class' => 'upload_file_ot']) ?>
                    <?php ActiveForm::end() ?>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <a type="button" class="btn btn-primary ajax_post_tag">提交</a>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="picture-content-modal" style="background: rgba(236, 230, 230, 0.3);" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 70%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">图片描述</h4>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label for="tag_group_id_add">内容</label>
                    <p id="picture_content"></p>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <a type="button" class="btn btn-primary ajax_post_tag">提交</a>
            </div>
        </div>
    </div>
</div>
<input type="hidden" id="check_img_val"/>
<input type="hidden" id="img_type">
<input type="hidden" name="imageBathUrl" id="imageBathUrl" value="<?php echo Yii::$app->params['imageBathUrl'] . '/' ?>">
<!-- 固定js -->
<script type="text/javascript" src="/static/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="/static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/plugins/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="/static/jBox/jquery.jBox-2.3.min.js"></script>
<script type="text/javascript" src="/static/jBox/i18n/jquery.jBox-zh-CN.js"></script>
<script type="text/javascript" src="/static/plugins/treeTable/jquery.treetable.js"></script>
<!-- 图片上传插件用 -->
<script type="text/javascript" src="/static/plugins/jquery.form.js"></script>
<!-- 图片显示用 -->
<script type="text/javascript" src="/static/plugins/layer/layer.js"></script>
<!-- 自定义js -->
<script type="text/javascript" src="/static/app/global.js?version=<?=Yii::$app->params['version']?>"></script>
<script type="text/javascript" src="/static/app/category-child-maintain/index.js?version=<?=Yii::$app->params['version']?>"></script>